<template>
  <div>
    <el-form :inline="true">
      <el-form-item label="商户名称">
        <el-input
          v-model="input"
          placeholder="请输入商户名称"
          style="width: 300px"
          clearable
          @change="change"
        ></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="query">搜索</el-button>
      </el-form-item>
    </el-form>

    <el-card v-if="info" shadow="always">
      <el-row :gutter="20">
        <el-col :span="6" v-for="(item, index) in keyLabel" :key="index"
          >{{ item }}：{{ info[index] }}</el-col
        >
      </el-row>

      <el-row :gutter="20">
        <el-col :span="6" v-for="(item, index) in qy" :key="index"
          >{{ item }}：{{ info[index] }}</el-col
        >
      </el-row>

      <el-row :gutter="20">
        <el-col :span="6" v-for="(item, index) in gr" :key="index"
          >{{ item }}：{{ info[index] }}</el-col
        >
      </el-row>

      <el-row :gutter="20">
        <el-col :span="6">审核意见 ：{{ info.audit_desc }}</el-col>
      </el-row>
      <div style="margin-top: 10px; text-align: center">
        <el-button :disabled="info.audit_state !== 'B' && info.audit_state !== 'C'" @click="clearBT"
          >清理</el-button
        >
      </div>
    </el-card>
  </div>
</template>

	
<script>
export default {
  data() {
    return {
      info: null,
      input: '',
      keyLabel: {
        distributor_id: '店铺号',
        distributor_name: '店铺名称',
        contact: '店铺联系人',
        mobile: '店铺手机号码'
      },
      gr: {
        name: '姓名',
        cert_id: '身份证号码',
        tel_no: '手机号码'
      },
      qy: {
        name: '企业名称',
        legal_person: '法人姓名',
        cert_id: '法人身份证号码',
        tel_no: '手机号码'
      }
    }
  },
  mounted() {},
  methods: {
    async clearBT() {
      const data = await this.$api.adapay.auditDataClear({
        reset_id: this.info.id
      })
      this.info = null
    },
    change(v) {
      this.info = null
    },
    async query() {
      const data = await this.$api.adapay.getAuditData({
        name: this.input
      })

      this.info = data.info
      if (!data.info) {
        this.$message('信息不存在')
      }
    }
  }
}
</script>

<style>
</style>